/**
 * CatalogPieceOfProduct.java 21 juil. 07
 *
 * Copyright (c) 2007 windu.2b <jcaddie@windu2b.org>. All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package org.windu2b.jcaddie.model;

import java.text.*;

import org.windu2b.jcaddie.model.UserPreferences.*;

/**
 * @author windu.2b
 * 
 */
public class CatalogPieceOfProduct extends AbstractPieceOfProduct implements
        Comparable<CatalogPieceOfProduct>
{
	/**
	 * 
	 */
	private static final long	  serialVersionUID	= 6487498690625677508L;


	private static final Collator	COMPARATOR	   = Collator.getInstance();




	public CatalogPieceOfProduct( String name, Content icon, Category category,
	        Float price, Float poids, Unit unit )
	{
		super( name, icon, category, price, poids, unit );
		COMPARATOR.setStrength( Collator.PRIMARY );
		loadModeles();
	}




	/**
	 * Permet de (re)charger la liste des modèles de produits existants
	 */
	private void loadModeles()
	{
	}




	@Override
	public boolean equals( Object obj )
	{
		return obj instanceof CatalogPieceOfProduct
		        && COMPARATOR.equals( getName(),
		                ( ( CatalogPieceOfProduct ) obj ).getName() );
	}




	@Override
	public int hashCode()
	{
		return getName().hashCode();
	}




	/**
	 * @see java.lang.Comparable#compareTo(java.lang.Object)
	 */
	public int compareTo( CatalogPieceOfProduct product )
	{
		return COMPARATOR.compare( getName(), product.getName() );
	}
}